﻿using System;
using System.Runtime.Serialization;

namespace Mads.CoreDomain
{
  /// <summary>
  /// Base class for CoreDomain objects.
  /// </summary>
  [DataContract]
  public abstract class KeyAbstraction
  {
    /// <summary>
    /// Id of the object, used as primary key in database.
    /// </summary>
    [DataMember]
    public uint? ID { get; set; }

    public KeyAbstraction()
    {
      ID = null;
    }

    public KeyAbstraction(uint id)
    {
      if (id <= 0)
      {
        throw new ArgumentException("id");
      }

      ID = id;
    }
  }
}